package test2.redis;

import java.util.HashSet;
import java.util.Set;

import org.junit.Test;

public class IdTest {

	public static void main(String[] args) {
		String tab = "demo";
		System.out.println(1);
		IdGenerator idGenerator = IdGenerator.builder()
				.addHost("127.0.0.1", 6379, "fce3758b2e0af6cbf8fea4d42b379cd0dc374418")
//				.addHost("127.0.0.1", 7379, "1abc55928f37176cb934fc7a65069bf32282d817")
//				.addHost("127.0.0.1", 8379, "b056d20feb3f89483b10c81027440cbf6920f74f")
				.build();
		Set set = new HashSet();
		for(int i=0;i<10000;i++) {
		long id = idGenerator.next(tab);
//		System.out.println("id:" + id);
//		List<Long> result = IdGenerator.parseId(id);
//
//		System.out.println("miliSeconds:" + result.get(0) + ", partition:"
//				+ result.get(1) + ", seq:" + result.get(2));
		System.out.println(id);
		set.add(id);
		}
		System.out.println(set.size());
	}
	
	@Test
	public void test1() {
		System.out.println("12238057415639040000".length());
		System.out.println("6119035566194425859".length());
	}
	
}
